from django.db import models

# Create your models here.

# 用户类
type = ((1,'学生'),(2,'老师'))
class Users(models.Model):
    uname = models.CharField(max_length=20,null=False)
    upwd = models.CharField(max_length=20,null=False)
    role = models.IntegerField(choices=type)

# 请假类型
class Type(models.Model):
    tname = models.CharField(max_length=20,null=False)

# 请假模型
TYPE = ((0,'待审核'),(1,'通过'),(2,'不通过'))
class Leave(models.Model):

    stu_name = models.CharField(max_length=20,null=False)
    status = models.IntegerField(choices=TYPE,default=0)
    time = models.DateTimeField(auto_now=False,auto_now_add=True)
    content = models.CharField(max_length=200,null=False)
    tid = models.ForeignKey(Type,on_delete=models.CASCADE)